using System;
using System.Collections.Generic;
using System.Text;
using DTO;
using DAO;

namespace BUS
{
    public class PhongBUS
    {
        public PhongDTO[] LayDanhSachPhong()
        {
            PhongDTO[] Arr = new PhongDTO[100];
            try
            {
                PhongDAO pDAO = new PhongDAO();
                Arr = pDAO.LayDanhSachPhong();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return Arr;
        }

        public int LapDanhMucPhong(int ID, string MaP, string TenP, int MaLP, string GhiChu, int MaTT)
        {
            ID = 0;
            try
            {
                PhongDAO pDAO = new PhongDAO();
                ID = pDAO.LapDanhMucPhong(ID, MaP, TenP, MaLP, GhiChu, MaTT);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return ID;
        }
        public PhongDTO[] TimKiemPhong(int ID, string MaP, string TenP, int MaLoai, string GhiChu, int TinhTrang)
        {
            PhongDTO[] Arr = new PhongDTO[100];
            try
            {
                PhongDAO pDAO = new PhongDAO();
                Arr = pDAO.TimKiemPhong(ID, MaP, TenP, MaLoai, GhiChu, TinhTrang);
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return Arr;
        }

        public void CapNhatPhong(int ID, string MaP, string TenP, int MaLoai, string GhiChu, int MaTT)
        {
            try
            {
                PhongDAO pDAO = new PhongDAO();
                pDAO.CapNhatPhong(ID, MaP, TenP, MaLoai, GhiChu, MaTT);
            }
            catch(Exception ex)
            {
                throw ex;
            }
        }

        public void XoaPhong(int ID)
        {
            try
            {
                PhongDAO pDAO = new PhongDAO();
                pDAO.XoaPhong(ID);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}